export const formatCheck = {
    // 手机号合法校验  phoneNumber ：校验手机号
    phoneCheck(phoneNumber:string) {
		phoneNumber = phoneNumber + '';
		let reg_tel = /^(1[3-9])\d{9}$/;
		if(!reg_tel.test(phoneNumber)){
			return false
		}
		return true
    },
	// 邮箱合法校验  email ： 校验邮箱
	emailCheck(email:string) {
		let reg_email = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
		if(!reg_email.test(email)){
			return false
		}
		return true
	},
	// 身份证合法校验 idCard ：校验身份证号
	idCardCheck(idCard:string) {
		idCard = idCard + '';
		let reg_tel = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
		if(!reg_tel.test(idCard)){
			return false
		}
		return true
	},
	// 文本合法校验 notChinese ：非中文符
	isInlcudeChinese(text:string) {
		text = text + '';
		let reg_tel = /.*[\u4e00-\u9fa5]+.*$/;
		if(!reg_tel.test(text)){
			return false
		}
		return true
	},
}
export const formatDate = {
	dateTimeFormat(datetime:any) {
		let date = new Date(datetime);
		let YY = (date.getFullYear() + '').substring(2,4) + '-';
		let MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
		let DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
		let hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
		let mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
		return YY + MM + DD +" " + hh + mm
	},
	dateTimeAllFormat(datetime:any) {
		let date = new Date(datetime);
		let YYYY = (date.getFullYear() + '').substring(0,4) + '-';
		let MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
		let DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
		let hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
		let mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
		let ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
		return YYYY + MM + DD +" " + hh + mm + ss
	},
	dateFormat(dateValue:any) {
		let date = new Date(dateValue);
		let YYYY = (date.getFullYear() + '').substring(0,4) + '-';
		let MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
		let DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
		return YYYY + MM + DD
	},
}